.TH std::logical_not 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::logical_not \- std::logical_not

.SH Synopsis
   Defined in header <functional>
   template< class T >             \fI(until C++14)\fP
   struct logical_not;
   template< class T = void >      \fI(since C++14)\fP
   struct logical_not;

   Function object for performing logical NOT (logical negation). Effectively calls
   operator! for type T.

.SH Specializations

   The standard library provides a specialization of std::logical_not
   when T is not specified, which leaves the parameter types and return
   type to be deduced.
                                                                          \fI(since C++14)\fP
   logical_not<void> function object implementing !x deducing parameter
   \fI(C++14)\fP           and return types
                     \fI(class template specialization)\fP

.SH Member types

   Type                                                  Definition
   result_type (deprecated in C++17)(removed in C++20)   bool
   argument_type (deprecated in C++17)(removed in C++20) T

   These member types are obtained via publicly inheriting                \fI(until C++11)\fP
   std::unary_function<T, bool>.

.SH Member functions

   operator() returns the logical NOT of the argument
              \fI(public member function)\fP

std::logical_not::operator()

   bool operator()( const T& arg ) const;            \fI(until C++14)\fP
   constexpr bool operator()( const T& arg ) const;  \fI(since C++14)\fP

   Returns the logical NOT of arg.

.SH Parameters

   arg - value to compute logical NOT of

.SH Return value

   The result of !arg.

.SH Exceptions

   May throw implementation-defined exceptions.

.SH Possible implementation

   constexpr // since C++14
   bool operator()(const T& arg) const
   {
       return !arg;
   }
